package com.iris.string;

import java.util.HashMap;
import java.util.Map;

public class StringTest {
	public static final Map<String,String> map=new HashMap<String,String>();
	public static void putSomeThing(){
		map.put("111", "111");
		map.put("222", "222");
	}
	public static String getSomeThing(){
		return map.get("222");
	}
	public void jsonTest(){
		String str="{\"code\":\"100\",\"msge\":\"用户/密码不正确！\"}";
		str =str.substring( str.indexOf("code")+5);
		str =str.substring( str.indexOf("\"")+1);
		String code = str.substring(0,str.indexOf("\""));
		str =str.substring( str.indexOf("msge")+5);
		str =str.substring( str.indexOf("\"")+1);
		System.out.println(code);
		System.out.println(str);
	}
	
	public void subTest(){
		String schema="jdbc:mysql://127.0.0.1:3307/cmbdb";
		schema=schema.substring(schema.lastIndexOf("/")+1,schema.length());
		System.out.println(schema);
	}
	public void contains(){
		String str="sdfsdfsf*sdf,";
		System.out.println(str.indexOf("*"));
	}
	public static void main(String[] args) {
		StringTest st = new StringTest();
		st.segmentHash();
	}

	public void segmentHash(){
		System.out.println(Integer.toBinaryString(15));
		System.out.println(Integer.parseInt("0001111", 2) & 15);
		System.out.println(Integer.parseInt("0011111", 2) & 15);
		System.out.println(Integer.parseInt("0111111", 2) & 15);
		System.out.println(Integer.parseInt("1111111", 2) & 15);
	}
	
	public void test(){
		byte[]  b = new byte[2014];
		b[0]=(byte) 0xf5;
		int dd = 22;
//		new String(dd).getBytes();
		String hex = Integer.toHexString(Integer.MAX_VALUE);
		System.out.println(hex);
		System.out.println(Integer.parseInt("7f",16));
		System.out.println(Byte.parseByte("7f",16));
	}
	
}
